package cn.wolfcode.web.controller;

import cn.wolfcode.domain.User;
import cn.wolfcode.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@RequestMapping("/zhuce")
@Controller
public class zhuceController {
    @Autowired
    private IUserService userService;
    @RequestMapping("/register")
    public ModelAndView zhuce(String username, String password, int age){
        ModelAndView mv=new ModelAndView();
        System.out.println(username);
        System.out.println(password);
        System.out.println(age);
        User u = new User();
        u.setUsername(username);
        u.setPassword(password);
        u.setAge(age);
        userService.insert(u);
        mv.addObject("username",username);
        mv.addObject("password",password);
        mv.addObject("age",age);
        mv.setViewName("forward:/WEB-INF/views/zhucechenggong.jsp");
        return mv;
    }
}
